#ifndef THINK_THINK_RESPONSE_VIEW_H
#define THINK_THINK_RESPONSE_VIEW_H

static char* think_response_view =
	"\n"
	"// +----------------------------------------------------------------------\n"
	"// | ThinkPHP [ WE CAN DO IT JUST THINK ]\n"
	"// +----------------------------------------------------------------------\n"
	"// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.\n"
	"// +----------------------------------------------------------------------\n"
	"// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n"
	"// +----------------------------------------------------------------------\n"
	"// | Author: liu21st <liu21st@gmail.com>\n"
	"// +----------------------------------------------------------------------\n"
	"\n"
	"namespace think\\response;\n"
	"\n"
	"use think\\Config;\n"
	"use think\\Response;\n"
	"use think\\View as ViewTemplate;\n"
	"\n"
	"class View extends Response\n"
	"{\n"
	"    // 输出参数\n"
	"    protected $options     = [];\n"
	"    protected $vars        = [];\n"
	"    protected $replace     = [];\n"
	"    protected $contentType = \'text/html\';\n"
	"\n"
	"    /**\n"
	"     * 处理数据\n"
	"     * @access protected\n"
	"     * @param mixed $data 要处理的数据\n"
	"     * @return mixed\n"
	"     */\n"
	"    protected function output($data)\n"
	"    {\n"
	"        // 渲染模板输出\n"
	"        return ViewTemplate::instance(Config::get(\'template\'), Config::get(\'view_replace_str\'))\n"
	"            ->fetch($data, $this->vars, $this->replace);\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 获取视图变量\n"
	"     * @access public\n"
	"     * @param string $name 模板变量\n"
	"     * @return mixed\n"
	"     */\n"
	"    public function getVars($name = null)\n"
	"    {\n"
	"        if (is_null($name)) {\n"
	"            return $this->vars;\n"
	"        } else {\n"
	"            return isset($this->vars[$name]) ? $this->vars[$name] : null;\n"
	"        }\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 模板变量赋值\n"
	"     * @access public\n"
	"     * @param mixed $name  变量名\n"
	"     * @param mixed $value 变量值\n"
	"     * @return $this\n"
	"     */\n"
	"    public function assign($name, $value = \'\')\n"
	"    {\n"
	"        if (is_array($name)) {\n"
	"            $this->vars = array_merge($this->vars, $name);\n"
	"            return $this;\n"
	"        } else {\n"
	"            $this->vars[$name] = $value;\n"
	"        }\n"
	"        return $this;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 视图内容替换\n"
	"     * @access public\n"
	"     * @param string|array $content 被替换内容（支持批量替换）\n"
	"     * @param string  $replace    替换内容\n"
	"     * @return $this\n"
	"     */\n"
	"    public function replace($content, $replace = \'\')\n"
	"    {\n"
	"        if (is_array($content)) {\n"
	"            $this->replace = array_merge($this->replace, $content);\n"
	"        } else {\n"
	"            $this->replace[$content] = $replace;\n"
	"        }\n"
	"        return $this;\n"
	"    }\n"
	"\n"
	"}\n"
	"\n"
;
#endif